package com.stox.client.ui.javafx.chartingy.model.plot;

import com.stox.client.ui.javafx.chartingy.model.chart.Chart;
import com.stox.client.ui.javafx.chartingy.model.chart.PrimaryChart;
import com.stox.client.ui.javafx.chartingy.model.node.DataNode;
import com.stox.client.ui.javafx.chartingy.view.ChartingView;

public class Data<T, V> {

	private long date;
	private double value;
	private double max;
	private double min;
	private DataNode<T, V> dataNode;
	private V extraValue;
	private final int index;
	private final Plot<T, V> plot;
	
	public Data(Plot<T, V> plot, int index) {
		this.plot = plot;
		this.index = index;
	}

	public Data(long date, double value, double max, double min, V extraValue, Plot<T, V> plot, int index) {
		super();
		this.date = date;
		this.value = value;
		this.max = max;
		this.min = min;
		this.extraValue = extraValue;
		this.plot = plot;
		this.index = index;
	}
	
	public int getIndex() {
		return index;
	}
	
	public V getExtraValue() {
		return extraValue;
	}
	
	public void setExtraValue(V extraValue) {
		this.extraValue = extraValue;
	}

	public long getDate() {
		return date;
	}

	public void setDate(long date) {
		this.date = date;
	}

	public double getValue() {
		return value;
	}

	public void setValue(double value) {
		this.value = value;
	}

	public DataNode<T, V> getDataNode() {
		return dataNode;
	}
	
	public double getMax() {
		return max;
	}
	
	public void setMax(double max) {
		this.max = max;
	}
	
	public double getMin() {
		return min;
	}
	
	public void setMin(double min) {
		this.min = min;
	}

	public void setDataNode(DataNode<T, V> dataNode) {
		this.dataNode = dataNode;
	}

	public Plot<T, V> getPlot() {
		return plot;
	}
	
	/**
	 * Utility method
	 * @return
	 */
	public Chart<T, V> chart(){
		return plot.getChart();
	}
	public ChartingView chartingView(){
		return plot.chartingView();
	}
	public PrimaryChart primaryChart(){
		return plot.primaryChart();
	}
	public PricePlot primaryPlot(){
		return plot.primaryPlot();
	}
}
